﻿@using ZBJF.Warranty.BLL
@using ZBJF.Warranty.Common.Enums.Base
@using ZBJF.Warranty.Common.Enums.Certificate
@using ZBJF.Warranty.Common.Enums.InsuranceProducts
@using ZBJF.Warranty.WebProvider
@model ZBJF.Warranty.Model.ViewModel.Order.InsuranceOrderModel
@{
    ViewBag.Title = "投保信息确认";
    var currentUser = CurrentLoginUser.CurrentUser;
    var sellerId = Model.SellerID > 0 ? Model.SellerID : long.Parse(Request["SellerId"] ?? "0");
    var sellerEmployeeID = Model.SellerEmployeeID > 0 ? Model.SellerEmployeeID : long.Parse(Request["SellerEmployeeID"] ?? "0");
    if (sellerId <= 0 || sellerEmployeeID <= 0)//未登录或没有相关信息
    {
        Response.Redirect("/home");
    }
}
<div class="desc_forward_title" onclick="history.back(-1)">
    投保信息确认
</div>
<div class="weui-cell">
    @Model.SellerInsuranceProducts.ProductName
    <div class="weui-cell__bd price_desc align-right">
        @Model.SellerInsuranceProducts.SaleRetailPrice.ToString("c")
    </div>
</div>
<div class="space-4"></div>
<div>
    @using (Html.BeginForm("CreateInsuranceOrder", "InsuranceOrder", FormMethod.Post, new { id = "mvcForm", @class = "create-order-form" }))
    {
        <div class="weui-cells__title">设备信息</div>
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <label class="weui-label">品牌</label>
            </div>
            <div class="weui-cell__bd weui-msg__desc align-right">
                @Model.ProductBrandName
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <label class="weui-label">型号</label>
            </div>
            <div class="weui-cell__bd weui-msg__desc align-right">
                @Model.ProductModelName
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <label class="weui-label">IMEI</label>
            </div>
            <div class="weui-cell__bd weui-msg__desc align-right">
                @Model.IMEI
            </div>
        </div>
        <div class="space-4"></div>
        <div class="weui-cells__title">投保人信息</div>
        <div class="weui-cells weui-cells_form">
            @Html.AntiForgeryToken()
            @Html.Hidden("ID")
            @Html.Hidden("SellerEmployeeID", sellerEmployeeID)
            <div class="weui-cell">
                姓名：
                <div class="weui-cell__bd weui-cell_primary">
                    @Model.UserName
                </div>
            </div>
            <div class="weui-cell">
                证件类型：
                <div class="weui-cell__bd weui-cell_primary">
                    @ZBJF.Warranty.Common.Common.EnumHelper.Instance.GetDescription(typeof(UserCertificateType), Model.CertificateType)
                </div>
            </div>
            <div class="weui-cell">
                证件号码：
                <div class="weui-cell__bd weui-cell_primary">
                    @Model.CertificateNO
                </div>
            </div>
            <div class="weui-cell">
                手机号码：
                <div class="weui-cell__bd weui-cell_primary">
                    @Model.UserPhone
                </div>
            </div>
            <div class="weui-cell">
                电子邮箱：
                <div class="weui-cell__bd weui-cell_primary">
                    @Model.Email
                </div>
            </div>
            <div class="weui-cells__title">被保险人信息</div>
            <div class="weui-cell">
                与投保人关系：
                <div class="weui-cell__bd weui-cell_primary">
                    本人
                </div>
            </div>
            <div class="weui-cell">
                姓名：
                <div class="weui-cell__bd weui-cell_primary">
                    @Model.UserName
                </div>
            </div>
            <div class="weui-cell">
                证件类型：
                <div class="weui-cell__bd weui-cell_primary">
                    @ZBJF.Warranty.Common.Common.EnumHelper.Instance.GetDescription(typeof(UserCertificateType), Model.CertificateType)
                </div>
            </div>
            <div class="weui-cell">
                证件号码：
                <div class="weui-cell__bd weui-cell_primary">
                    @Model.CertificateNO
                </div>
            </div>
            <div class="weui-cell">
                出生日期：
                <div class="weui-cell__bd weui-cell_primary">
                    @Model.BirthDay
                </div>
            </div>
            <div class="weui-cell">
                性别：
                <div class="weui-cell__bd weui-cell_primary">
                    @ZBJF.Warranty.Common.Common.EnumHelper.Instance.GetDescription(typeof(SexEnums), Model.Sex)
                </div>
            </div>
            <div class="weui-cell">
                邮箱：
                <div class="weui-cell__bd weui-cell_primary">
                    @Model.Email
                </div>
            </div>
            <div class="weui-form-preview__ft weui-footer_fixed-bottom">
                <div class="weui-cell pay_insurance_order">
                    <div class="total_price">
                        <label>应付保费: </label><label id="TotalPrice" class="red" name="TotalPrice">@Model.SellerInsuranceProducts.SaleRetailPrice.ToString("c")</label>
                    </div>
                    <input type="submit" class="weui-btn weui-btn_mini weui-btn_primary" value="确认">
                </div>
            </div>
        </div>
    }
</div>

<script type="text/javascript">
    function createInsurance(parameters) {
        if ($("#mvcForm").valid()) {
            $("#mvcForm").submit();
        }
    }
</script>